﻿@model Lead2012.ViewModels.LeadViewModel
@{
    ViewBag.Title = "In khách hàng";
    Layout = "";
}


<!DOCTYPE html >
<html class="fixed-width print">
<head>
	<meta charset="utf-8" />
    <title>@ViewBag.Title - Quản lý quan hệ khách hàng | Gia Linh Software Solution., Ltd.</title>
    <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <meta name="viewport" content="width=device-width" />

    <link rel="stylesheet" type="text/css" href="/Content/jqueryui.css" media="all" />
    <link rel="stylesheet" type="text/css" href="/Content/jquerytimepicker.css" />
    <link rel="stylesheet" type="text/css" href="/Content/all.css" />
    <link rel="stylesheet" type="text/css" href="/Content/gridview.css" />
    <!--[if IE 8]><link rel="stylesheet" type="text/css" href="/Content/ie8.css" media="all" /><![endif]-->

    <script type="text/javascript" src="/Scripts/lib/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/Scripts/lib/jquery.jsonp.js"></script>
    <script type="text/javascript" src="/Scripts/lib/jquery.validate.min.js"></script>
    <script type="text/javascript" src="/Scripts/lib/knockout-latest.js"></script>
    <script type="text/javascript" src="/Scripts/lib/knockout.validation.js"></script>
    <script type="text/javascript" src="/Scripts/lib/jquery-ui-1.8.23.custom.min.js"></script>
    <script type="text/javascript" src="/Scripts/lib/jquery-ui-timepicker-addon.js"></script>
    <script type="text/javascript" src="/Scripts/lib/jquery.validate.custom.js"></script>
    <script type="text/javascript" src="/Scripts/lib/fancybox.js"></script>
    <script type="text/javascript" src="/Scripts/lib/jquery.editable-select.js"></script>
    <script type="text/javascript" src="/Scripts/lib/jquery.cookie.js"></script>
    <script type="text/javascript" src="/Scripts/lib/swfobject.js"></script>
    <script type="text/javascript" src="/Scripts/lib/jquery.uploadify.js"></script>
    <script type="text/javascript" src="/Scripts/superfish.js"></script>
    <script type="text/javascript" src="/Scripts/jquery.main.js"></script>
    <script type="text/javascript" src="/Scripts/global.js"></script>
    <script type="text/javascript" src="/Scripts/common.js"></script>
</head>
<body class="leads-view edit-lead-print">
@if (Model != null)
{
    <div id="wrapper">
		<div class="w1">

			<div id="main">
				<section class="container">
					<form action="#" class="form">
						<fieldset>
						
						 	<div class="content">
								
								<h3 class="centered-wbtn no-border">
  								    <span class="name">
                                        <span class="nameText">@Model.LeadName </span>
                                        <span class="dateAdd">Ngày thêm: @Model.DateAdd</span>
                                    </span>
                                    <div id="print-leads-btns">
                                        <a class="btn btn-print-small" href="javascript:void(0);" onclick="javascript:window.print();">Print</a>
                                        <a class="btn btn-close-small" href="javascript:void(0);" onclick="javascript:window.close();">Close</a>
                                    </div>
								</h3>
                
                                <div class="table lead-print-header">
                                    <div class="row">
                                    <div class="col1"><strong>ID:</strong>@Model.LeadId</div>
                                    <div class="col1 col2"><strong>Ngày thêm:</strong> <span data-bind="text: DateAdded"></span></div>
                                    <div class="col1 col3"><strong>Nguồn:</strong> @Model.LeadSourceTitle</div>
                                    <div class="col1 col4"><strong>Tình trạng:</strong> @Model.LeadStatusName</div>
                                    <div class="col1 col5"><strong>Người sở hữu:</strong> @Model.User</div>
                                    </div>
                                </div>

                                @foreach (var itemTab in Model.ListTab)
                                {
                                    <div class="title nomargin">
									    <h3>@itemTab.Title</h3>
								    </div>
                                    <div class="panel table">
                                    @if (itemTab.Fields != null && itemTab.Fields.Count > 0)
                                    {
                                        System.Text.StringBuilder col1 = new System.Text.StringBuilder();
                                        System.Text.StringBuilder col2 = new System.Text.StringBuilder();
                                        

                                        col1.Append("<div class=\"col1\">");
                                        col2.Append("<div class=\"col1\">");
                                        

                                        int index = 1;
                                        
                                        <div class="row">
                                            @foreach (var item in itemTab.Fields)
                                            {
                                                string itemValue = item.Value.Equals("true") ? "Yes" : item.Value;
                                                string classCss = string.Empty;
                                                if (item.TypeId == 2048)
                                                {
                                                    classCss = "force-wrap breakAllWord";
                                                }
                                                
                                                if (index == 1)
                                                {
                                                    col1.Append("<div class=\"row\">");
                                                    col1.AppendFormat("<div class=\"left\"><strong>{0}:</strong></div>", item.Title);
                                                    col1.AppendFormat("<div class=\"right\"><span class=\"{0}\">{1}</span></div>", classCss, itemValue);
                                                    col1.Append("</div>");
                                                }
                                                else
                                                {
                                                    col2.Append("<div class=\"row\">");
                                                    col2.AppendFormat("<div class=\"left\"><strong>{0}:</strong></div>", item.Title);
                                                    col2.AppendFormat("<div class=\"right\"><span class=\"{0}\">{1}</span></div>", classCss, itemValue);
                                                    col2.Append("</div>");
                                                }
                                                
                                                index++;
                                                if (index > 2) { index = 1; }
                                            }
                                            @{
                                                col1.Append("</div>");
                                                col2.Append("</div>");
                                                
                                            }
                                            @Html.Raw(col1.ToString())
                                            @Html.Raw(col2.ToString())
                                            
                                        </div>
                                    }
                                    @if (itemTab.Groups != null && itemTab.Groups.Count > 0)
                                    {
                                        foreach (var itemGroup in itemTab.Groups)
                                        {
                                            <div class="row table lead-print-header"><strong>@itemGroup.Title</strong></div>
                                            if (itemGroup.Fields != null && itemGroup.Fields.Count > 0)
                                            {
                                                System.Text.StringBuilder col1 = new System.Text.StringBuilder();
                                                System.Text.StringBuilder col2 = new System.Text.StringBuilder();
                                                

                                                col1.Append("<div class=\"col1\">");
                                                col2.Append("<div class=\"col1\">");
                                                

                                                int index = 1;
                                        
                                                <div class="row">
                                                    <div class="wrapper">
                                                    @foreach (var item in itemGroup.Fields)
                                                    {
                                                        string itemValue = item.Value.Equals("true") ? "Yes" : item.Value;
                                                        string classCss = string.Empty;
                                                        if (item.TypeId == 2048)
                                                        {
                                                            classCss = "force-wrap breakAllWord";
                                                        }
                                                        
                                                        if (index == 1)
                                                        {
                                                            col1.Append("<div class=\"row\">");
                                                            col1.AppendFormat("<div class=\"left\"><strong>{0}:</strong></div>", item.Title);
                                                            col1.AppendFormat("<div class=\"right\"><span class=\"{0}\">{1}</span></div>", classCss, itemValue);
                                                            col1.Append("</div>");
                                                        }
                                                        else
                                                        {
                                                            col2.Append("<div class=\"row\">");
                                                            col2.AppendFormat("<div class=\"left\"><strong>{0}:</strong></div>", item.Title);
                                                            col2.AppendFormat("<div class=\"right\"><span class=\"{0}\">{1}</span></div>", classCss, itemValue);
                                                            col2.Append("</div>");
                                                        }
                                                        
                                                        index++;
                                                        if (index > 2) { index = 1; }
                                                    }
                                                    @{
                                                            col1.Append("</div>");
                                                            col2.Append("</div>");
                                                            
                                                    }
                                                    @Html.Raw(col1.ToString())
                                                    @Html.Raw(col2.ToString())
                                                    
                                                    </div>
                                                </div>
                                            }
                                        }
                                    }
                                    </div>
                                }
                
							</div><!-- //.content -->
              
						</fieldset>
					</form>
				</section>
			</div>
			
		</div>
	</div>

    <script type="text/javascript">
        var data = @(Html.Raw(Json.Encode(Model)));
    </script>
    <script src="/Scripts/Leads/PrintLeadViewModel.js" type="text/javascript"> </script>
}
</body>
</html>